package Questions;

/**
 * @version 3 18 February 2013
 * @author Myhaylo Kotsyuruba
 */

public class QuestionsCreator {
    private QuestionsCreator() {
    }

    public static Question createQuestion(String question) {
        int key = Integer.parseInt(question.substring(0, 4));
        String data = question.substring(4, question.length());
        Question result;
        switch (key) {
            case(1):
                result = YesNoQuestion.createQuestion(data);
                break;
            case(2):
                result = OneAnswerQuestion.createQuestion(data);
                break;
            case(3):
                result = ManyAnswersQuestion.createQuestion(data);
                break;
            case(4):
                result = VerbalQuestion.createQuestion(data);
                break;
            case(5):
                result = RangeQuestion.createQuestion(data);
                break;
            default: result = null;
        }
        return result;
    }
}
